// @flow

import React from 'react';
import PropTypes from 'prop-types';
import Cell from './Cell'

class TableRow extends React.Component {
    constructor(props) {
        super(props);
    }

    render() {

        const data = this.props.data;
        const columns = this.props.columns;

        return (
            <div>
                {
                    data.map((item, index) => {
                        let trStyle = '';
                        if (index % 2 !== 0) {
                            trStyle = 's-bs-table__content__tr--even'
                        } else {
                            trStyle = 's-bs-table__content__tr--odd'
                        }
                        return (
                            <div className={`s-bs-table__content__tr ${trStyle}`} key={`${index}`}>
                                <Cell
                                    item={item}
                                    {...this.props}
                                    rowIndex={index}
                                />
                            </div>
                        )
                    })
                }
            </div>
        );
    }
}

TableRow.propTypes = {
    data: PropTypes.array.isRequired,
    columns: PropTypes.array.isRequired,
    onInputChange: PropTypes.func.isRequired,
    changeCellEditStatus: PropTypes.func,
}

export default TableRow;
